<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator" %>  
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ page import="org.apache.shiro.SecurityUtils" %>
<%@ page import="com.topisv.tms.entity.Function" %>
<%@ page import="java.util.List" %>
<%@ page import="com.topisv.tms.service.account.ShiroDbRealm.ShiroUser" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
<title>风之鱼WMS V2.0<sitemesh:title/></title>
<script type="text/javascript">
 var path='${ctx}';
 var CNPrint;
</script>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="Cache-Control" content="no-store" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<%@ include file="/WEB-INF/layouts/v2/mete_v2.jsp"%>

<sitemesh:head/>


</head>

<body class="skin-blue">
		<%@ include file="/WEB-INF/layouts/v2/header_v2.jsp"%>
		<shiro:user>
		  <div class="wrapper row-offcanvas row-offcanvas-left">
            <!-- Left side column. contains the logo and sidebar -->
            <aside class="left-side sidebar-offcanvas">
                <!-- sidebar: style can be found in sidebar.less -->
                <section class="sidebar">
                    <!-- Sidebar user panel -->
                    <div class="user-panel">
                        <div class="pull-left image">
                            <img src="${ctx}/static/v2/img/avatar5.png" class="img-circle" alt="User Image" />
                        </div>
                        <div class="pull-left info">
                            <p>Hello,<shiro:principal property="realname"/></p>

                            <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
                        </div>
                    </div>
                    <!-- search form -->
<!--                     <form action="#" method="get" class="sidebar-form"> -->
<!--                         <div class="input-group"> -->
<!--                             <input type="text" name="q" class="form-control" placeholder="订单号..."/> -->
<!--                             <span class="input-group-btn"> -->
<!--                                 <button type='submit' name='seach' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button> -->
<!--                             </span> -->
<!--                         </div> -->
<!--                     </form> -->

<!-- 新菜单  开始-->		    

<ul class="sidebar-menu">

<%
	ShiroUser user = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
	List<Function> menus = user.menus;
	if(menus != null)
	{
		for(int i=0; i<menus.size(); i++)
		{
			Function menu = menus.get(i);
			String menuName = menu.getShowname();
			String menuUrl = menu.getUrlprefix();
			List<Function> childMenus = menu.getChildMenu();
          %>

           <shiro:hasPermission name="<%=menuUrl%>">

	     <li class="treeview">
	     <a href="#" class="dropmenu">
              <i class="fa fa-plus-square"></i>
              <span><%=menuName %></span>
              <i class="fa fa-angle-left pull-right"></i> 
          </a>
          
         <%	if(childMenus.size() != 0){%>
		 
		  <ul  class="treeview-menu" <%if(menuName.equals("订单处理")||menuName.equals("集发宝作业管理")){%> style="display: block;" <%}%>>
				<%
					for(int j=0; j<childMenus.size(); j++)
					{
						Function childMenu = childMenus.get(j);
						String childMenuName = childMenu.getShowname();
						String childMenuUrl = childMenu.getViewurl();
						List<Function> childMenus2 = childMenu.getChildMenu();
				%>
		 <shiro:hasPermission name="<%=childMenuUrl %>">
		    <li><a href="${ctx}<%=childMenuUrl %>" ><i class="fa fa-angle-double-right"></i><%=childMenuName %></a>  <!-- 2 level begin -->
		                                    
		                                    <%
											if(childMenus2 != null)
											{
											%>
											<%
											for(Function child : childMenus2)
											{
							                %>
							                <ul>
							                <shiro:hasPermission name="<%=child.getViewurl() %>">
					                          <li><a href="${ctx}<%=child.getViewurl() %>"><%=child.getShowname() %></a></li>
				                            </shiro:hasPermission>
				                            </ul>
								            <%} // for 3 %>
									         
								            
		                                    
		                                     <%} // if 3 %>
		    
		  </li><!-- 2 level end -->
		  </shiro:hasPermission>
		  <% 
           } // for 2
          %>
		
		  </ul>
		
		  <% 
           } // if 2
          %>

</li><!-- 1 level end -->
</shiro:hasPermission>
<% 
    } // for 1
} // if 1
%>	

</ul>
       
                </section>
                <!-- /.sidebar -->
            </aside>    
<!-- 新菜单  结束-->			    
	</shiro:user>
	
	    <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">
           
		    	<sitemesh:body/>
		    	
		    <!--Body content-->
  </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->
<%@ include file="/WEB-INF/layouts/v2/footer_v2.jsp"%>
<div id="commonMsgDiv" class="modal fade">
		<div class="modal-dialog" style="width: 60%;">
			<div class="modal-content">
				<div class="modal-body">
					<div class="box box-solid box-primary">
			      		<div class="box-header">
			      		<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
			      		<span class="box-title">消息提醒</span>
			      		</div>
						<div class="box-body">
							<div id="commonMsgDetail"></div>
						</div>
					</div>
				</div>
				
			</div>	
		</div>
	</div>
</body>
</html>